1 package org.thema.scriptware.teste;
2 import java.sql.*;
3 import java.util.regex.Pattern;
4 import org.thema.Util;
5
6 /***
7 * Classe utilizada para testes...
8 *
9 * @author Eduardo M. Sasso
10 * @since Jan 12, 2004
11 */
12
13 public class teste {
14 public teste() {
15 }
16
17 public static void main(String[] args) {
18 teste teste = new teste();
19 Connection conn=null;
20
21 String sql = "select object_name,object_type from user_objects where object_type=':type'";
22 Pattern pattern = Pattern.compile(":Type",Pattern.CASE_INSENSITIVE);
23 boolean matches = pattern.matcher(sql).find();
24 String resultado = pattern.matcher(sql).replaceAll("TABLE");
25 System.out.println(matches);
26 System.out.println(resultado);
27
28
29 String x = sql.replaceAll(":type", "Table");
30 System.out.println(x);
31
32 resultado = Util.replace(sql, ":Type", "Table", true);
33 System.out.println(resultado);
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 }
62
63 }